﻿using DPS.Prototype.Policy;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using DPS.Prototype.Model;
using DPS.Prototype.PolicyBase;
using System.Collections.Generic;

namespace DPSTesting
{
    
    
    /// <summary>
    ///This is a test class for DefaultProdCompetitorDataControllerTest and is intended
    ///to contain all DefaultProdCompetitorDataControllerTest Unit Tests
    ///</summary>
    [TestClass()]
    public class DefaultProdCompetitorDataControllerTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for InnerProcess
        ///</summary>
        [TestMethod()]
        [DeploymentItem("DPS.Prototype.dll")]
        public void InnerProcessTest()
        {
            PrivateObject param0 = TestHelper.GetProdCompetitorPrivateObject();
            DefaultProdCompetitor_Accessor target = new DefaultProdCompetitor_Accessor(param0); // TODO: Initialize to an appropriate value
            SubmitResult expected = null; // TODO: Initialize to an appropriate value
            SubmitResult actual;
            actual = target.CompeteProcess();
            SubmitResult actual1 = target.CompeteProcess();
            SubmitResult actual2 = target.CompeteProcess();
            SubmitResult actual3 = target.CompeteProcess();

            Assert.AreNotEqual(expected, actual);
            Assert.AreNotEqual(expected, actual1);
            Assert.AreNotEqual(expected, actual2);
            //  Assert.AreNotEqual(expected, actual3);

            foreach (Capacity c in target._prodLine.Capacitys)
            {
                Console.Write(c.SortNo + ":" + c.TobeOccupyUsage + ";  ");
            }
        }

        /// <summary>
        ///A test for InnerProcess
        ///</summary>
        [TestMethod()]
        [DeploymentItem("DPS.Prototype.dll")]
        public void InnerProcessTest1()
        {
            List<ProdLine> lines = DPS.Prototype.Factory.ProductLineProviderFactory.CreateProductLineProvider().GetAllProductLine();
            List<SubmitResult> results = new List<SubmitResult>();
            lines.ForEach(line =>
            {
                ProdCompetitorBase com = new DefaultProdCompetitor(line);
                PrivateObject param0 = new PrivateObject(com);
                DefaultProdCompetitor_Accessor target = new DefaultProdCompetitor_Accessor(param0); // TODO: Initialize to an appropriate value
                SubmitResult actual;
                actual = target.CompeteProcess();
                if (actual != null)
                {
                    results.Add(actual);
                }
            });
            results.ForEach(r => Console.WriteLine(r.ToString()));
        }
    }
}
